﻿using System;
namespace CoreEx.ServiceModel
{
    /// <summary>
    /// Represents a class that is capable of creating a valid <see cref="Uri"/>
    /// that represents the service endpoint for a given service type.
    /// </summary>
    /// <remarks>
    /// There is no default implementation of this interface.
    /// </remarks>
    /// <example>
    /// The following example shows how to implement the interface.
    /// <code>
    /// <![CDATA[
    /// [Implements(typeof(IUriProvider))]
    /// public class SampleUriProvider : IUriProvider
    /// {
    ///     public Uri CreateUri(Type serviceType)
    ///     {
    ///         return new Uri("http://localhost/SomeServiceApplication/");
    ///     }
    /// }    
    /// ]]>
    /// </code>
    /// </example>
    public interface IUriProvider
    {
        /// <summary>
        /// Creates a new <see cref="Uri"/> that represents 
        /// the service endpoint for the <param name="serviceType"/>.        
        /// </summary>
        /// <param name="serviceType">The service type for which to return an <see cref="Uri"/></param>
        /// <returns><see cref="Uri"/></returns>
        Uri CreateUri(Type serviceType);

        /// <summary>
        /// Creates a new <see cref="Uri"/> that represents 
        /// the service endpoint for the <param name="serviceType"/>.        
        /// </summary>
        /// <param name="serviceType">The service type for which to return an <see cref="Uri"/></param>
        /// <param name="serviceName">The name of the service for which to return an <see cref="Uri"/></param>
        /// <returns><see cref="Uri"/></returns>
        Uri CreateUri(Type serviceType, string serviceName);
    }
}
